<?php
require BASEPATH . '/plugins/doctrine/lib/Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine', BASEPATH . '/plugins/doctrine/lib');
$classLoader->register();

// Variable $configuration is defined inside cli-config.php
require BASEPATH . '/plugins/doctrine/cli-config.php';

$classLoader = new \Doctrine\Common\ClassLoader('Tasks', BASEPATH . '/plugins/doctrine/tools');
$classLoader->register();

$cli = new \Doctrine\Common\Cli\CliController($configuration);
$cli->addNamespace('Cid')
          ->addTask('MakeFolders', 'Tasks\MakeFoldersTask')
          ->addTask('Help', 'Tasks\HelpTask');

// If not arguments are defined, include "help"
if (empty($_SERVER['argv'])) {
    array_unshift($_SERVER['argv'], 'Cid:Help');
}
        
$cli->run($_SERVER['argv']);